import Vue from 'vue'
import VueRouter from 'vue-router'
import {routes} from '__ROUTER__/routes'
import NProgress from 'nprogress' 
Vue.use(VueRouter)

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
})

router.beforeEach((to, from, next)=>{
  NProgress.start()// start progress bar
  const nextPageTitle = to.meta.title
  document.title = 'Funny Station' +  (nextPageTitle ? ' ' + nextPageTitle : '')
  next()
})

router.afterEach(() => {
  NProgress.done() // finish progress bar
})

export default router
